<template>
         <div class="content-container">
            <el-dialog v-model="dialogTableVisible" lock-scroll="false" title="今日新增客户" modal="false" append-to-body="true" width='100%' fullscreen='true'>
                
              <el-table :data="tableData"
                  style="width: 100%;">
                  <!-- prop属性就是去tableData中的对象属性 -->
                  <el-table-column prop="id" label="客户名称" min-width="180" :fixed="true"/>
                  <el-table-column prop="name" label="归属人员" min-width="180" fixed="left"/>
                  <el-table-column prop="type" label="客户类别" min-width="160"/>
                  <el-table-column prop="industry" label="行业" min-width="180"/>
                  <el-table-column prop="date" label="创建日期" min-width="180"/>
                  <el-table-column prop="province" label="省份" min-width="180"/>
                  <el-table-column prop="city" label="城市" min-width="180"/>
              </el-table>
              <template v-slot:footer>
                 <div class="close" @click="close">X</div>
                  <div class="qw">
                        <span>共{{total}} 条记录</span>
                  </div> 
                     
              </template>
        
         </el-dialog>
         </div>
    
    
</template>
<script setup>
import echarts from 'echarts'
import { reactive, ref ,onMounted} from 'vue'
import ajax from '../../apis/ajax'
import {useRouter} from 'vue-router'
const router=useRouter()
const dialogTableVisible = ref(true)
const tableData = ref([])
  const query = reactive({
      id: '',
      page: 1,
      size: 10
  })
  const total = ref(0)
  
  onMounted(function() {
        const today = new Date();
        const year = today.getFullYear();//获取年份
        const month = today.getMonth() + 1;//获取月份
        const day = today.getDate();//获取日期
        if(month < 10){
            const month1 = '0' + month
            if(day < 10){
                const day1 = '0' + day
                const currentDate = year + "-" + month1 + "-" + day1
                getList(currentDate)
            }else{
                const currentDate = year + "-" + month1 + "-" + day
                getList(currentDate)
            }
        }else{
            if(day < 10){
                const day1 = '0' + day
                const currentDate = year + "-" + month + "-" + day1
                getList(currentDate)
            }else{
                const currentDate = year + "-" + month + "-" + day1
                getList(currentDate)
            }
        }
  })
//   const emit=defineEmits()
  function close(){
   router.push('/home')
     
  }
  function getList(currentDate) {
      ajax({
          url: '/customer/info/list',
          /* 如果是get请求，可以使用params对象来传递参数，他会自动进行url地址拼接 */
          method:'GET',
          params: {
            date: currentDate,
          }
      }).then(({data}) => {
            console.log(data.data)
          tableData.value = data.data.data
          total.value = data.data.total
      })
  }
  
</script>
<style lang="less">
    .content-container{
        width: 100%;
        height: 100%;
        
    }
    .el-dialog__headerbtn{
        display: none;
    }
    .close{
        position: absolute;
        left: 1400px;
        top:30px;
        width:40px;
        height: 30px;
        width: 30px;
        height: 30px;
        background: #c1c1bc;
        line-height: 30px;
        text-align: center;
        color: #fff;
        border-radius:10px ;
    }
</style>
